package com.shop.shop_end.controller;

import com.shop.shop_end.entity.Complain;
import com.shop.shop_end.entity.User;
import com.shop.shop_end.service.ComplainService;
import com.shop.shop_end.service.UserService;
import com.shop.shop_end.utils.result.Result;
import com.shop.shop_end.vo.ComplainVo;
import com.shop.shop_end.vo.UserVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author
 * @since 2024-04-23
 */
@RestController
@RequestMapping("/complain")
public class ComplainController extends BaseController{
    @Resource
    private ComplainService complainService;
    @Resource
    private UserService userService;

    // 添加数据
    @RequestMapping("addComplain")
    public Result addComplain(@RequestBody Complain complain) {
        return this.complainService.insertComplain(complain);
    }

    // 通过主键删除数据
    @RequestMapping("deleteComplain/{id}")
    public Result deleteComplain(@PathVariable("id") Long id) {
        return this.complainService.deleteComplain(id);
    }

    // 更新数据
    @RequestMapping("updateComplain")
    public Result updateComplain(@RequestBody Complain complain) {
        return this.complainService.updateComplain(complain);
    }

    // 更新状态
//    @RequestMapping("status")
//    public String status(Long id) {
//        String status = "";
//
//        if (status.equals(complains.getStatus())) {
//            status = "";
//        }
//        complains.setStatus(status);
//        this.complainService.updateComplain(complains);
//        return "redirect:/complains/getAllComplain";
//    }


}
